<div class="panel panel-default">
  <div class="panel-heading"><?= empty($data) ? '添加文章' : '编辑文章' ?></div>
  <div class="panel-body">
    <form action="<?=Yii::app()->createUrl('teacher/post_question',array('bank_id'=>$bank->bank_id))?>" method="post" class="form-horizontal">
      <fieldset>
        <?php 
        if(!empty($data)){
          echo CHtml::hiddenField('question_id',$data->question_id);
        }else{
          echo CHtml::hiddenField('bank_id',$bank->bank_id);
        }
        echo CHtml::hiddenField('bank_id',$bank->bank_id);
        ?>
        <div class="form-group">
          <label for="title" class="control-label col-md-1">题目名称</label>
          <div class="col-md-4">
            <textarea name="title" id="title" autofocus="" class="form-control" required="" rows="10"><?=CHtml::encode($data->title)?></textarea>
          </div>
        </div>
        <div class="form-group">
          <label for="answer_a" class="control-label col-md-1">答案 A</label>
          <div class="col-md-4">
            <input type="text" name="answer_a" id="answer_a" required="" value="<?=CHtml::encode($data->answer_a)?>" class="form-control">
          </div>
        </div>
        <div class="form-group">
          <label for="answer_b" class="control-label col-md-1">答案 B</label>
          <div class="col-md-4">
            <input type="text" name="answer_b" id="answer_b" required="" value="<?=CHtml::encode($data->answer_b)?>" class="form-control">
          </div>
        </div>
        <div class="form-group">
          <label for="answer_c" class="control-label col-md-1">答案 C</label>
          <div class="col-md-4">
            <input type="text" name="answer_c" id="answer_c" value="<?=CHtml::encode($data->answer_c)?>" class="form-control">
          </div>
        </div>
        <div class="form-group">
          <label for="answer_d" class="control-label col-md-1">答案 D</label>
          <div class="col-md-4">
            <input type="text" name="answer_d" id="answer_d" value="<?=CHtml::encode($data->answer_d)?>" class="form-control">
          </div>
        </div>
        <div class="form-group">
          <label class="control-label col-md-1">正确答案</label>
          <div class="col-md-2">
            <?=CHtml::radioButtonList('answer',empty($data)?'A':$data->answer,array(
              'A'=>'A',
              'B'=>'B',
              'C'=>'C',
              'D'=>'D'
            ))?>
          </div>
        </div>
        <div class="form-group">
          <div class="col-md-2 col-md-offset-1">
            <button type="submit" class="btn btn-primary btn-block">提交</button>
          </div>
        </div>
      </fieldset>
    </form>
  </div>
</div>
<script>
  $(function(){
    initEditor('editor');
    initiCheck();
  });
</script>